package one.stand.service.user;

import one.stand.entity.TokenEntity;
import one.stand.enums.LoginEnum;

import java.util.List;

/**
 * @author cjr
 */
public interface TokenService {

    String LOGIN_NULL = "0";
    String LOGIN_ONLINE = "1";
    String LOGIN_OFFLINE = "2";

    void save(TokenEntity tokenEntity);

    void saveAdmin(TokenEntity tokenEntity);

    void saveLoginStatus(Integer userId, String loginEnum);

    void remove(Integer userId, LoginEnum loginEnum);

    void remove(List<Long> userIds);

    void removeLoginStatus(Integer userId, LoginEnum loginEnum);

    void remove(String token);

    /**
     * 更新当前token，并移除其他端的登录
     *
     * @param userId
     * @param currentToken
     * @param tokenEntity
     */
    void update(Integer userId, String currentToken, TokenEntity tokenEntity);

    TokenEntity getInfo(String token);

    TokenEntity getAdminInfo(String token);

    TokenEntity getTokenfo(String token);

    boolean isLogin(String token);

    boolean isLoginStatus(Integer userId, LoginEnum loginEnum);

    boolean hasLoginStatus(Integer userId, LoginEnum loginEnum);

}
